//
//  SetupTableViewCell.m
//  Alltelevisionnews
//
//  Created by dllo on 15/11/27.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "SetupTableViewCell.h"

#define SWIDTH ([UIScreen mainScreen].bounds.size.width)
#define SHEIGHT ([UIScreen mainScreen].bounds.size.height)


@implementation SetupTableViewCell



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self create];
        
    }
    
    return self;
    
}


- (void)create {
    
    self.flowLayout = [[UICollectionViewFlowLayout alloc] init];
    self.flowLayout.itemSize = CGSizeMake(70 * SWIDTH / 375, 80 * SHEIGHT / 667);
    self.flowLayout.sectionInset = UIEdgeInsetsMake(5, 5, 5, 5);
    
    self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, SWIDTH, 100 * SHEIGHT / 667) collectionViewLayout:self.flowLayout];
    
   
    [self.contentView addSubview:self.collectionView];
    //默认背景的是黑色
    self.collectionView.backgroundColor = [UIColor greenColor];
    //签订代理人
    self.collectionView.dataSource = self;
    self.collectionView.delegate = self;
    
    
    //collectionView想要创建cell的话只能使用注册的方式
    [self.collectionView registerClass:[SetupCollectionViewCell class] forCellWithReuseIdentifier:@"reuse"];
    
}


- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return 4;
}


- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    
    SetupCollectionViewCell *cell = [self.collectionView dequeueReusableCellWithReuseIdentifier:@"reuse" forIndexPath:indexPath];
    
        return cell;
    
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    
//    [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
//        
//       make.top.and.left.and.bottom.and.right.equalTo(self.contentView).insets(UIEdgeInsetsMake(0, 0, 0, 0));
//        
//    }];
    
    
    
}




- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
